THIRD_PARTY_DIR=./third-party

LINENOISE_HOME=${THIRD_PARTY_DIR}/linenoise
LINENOISE_INC=-I$(LINENOISE_HOME)

RRCLIB_HOME=../rrclib
NBROKERLIB_HOME=../nbrokerlib
NBPF_HOME=../../nbpf
NBROKERLIB_INC=-I$(NBROKERLIB_HOME) -I$(RRCLIB_HOME)/include -I$(NBPF_HOME)
NBROKERLIB_LIB=$(NBROKERLIB_HOME)/libnbroker.a #-L$(NBROKERLIB_HOME) -lnbroker

INCLUDES=$(NBROKERLIB_INC) $(LINENOISE_INC)
LIBS=$(NBROKERLIB_LIB) -lpthread -lm -ldl -lzmq
CFLAGS=-g -Wall

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@

.PHONY: all clean
all: nbroker-cli

nbrokerlib:
	cd $(NBROKERLIB_HOME); make

nbroker-cli: nbrokerlib nbroker-cli.c
	${CC} $(CFLAGS) $(INCLUDES) nbroker-cli.c $(LIBS) -o nbroker-cli

install: nbroker-cli
	mkdir -p $(bindir)
	cp nbroker-cli $(bindir)/

clean:
	rm -f *.o *.a
	rm -f nbroker-cli

